package util;

import java.security.MessageDigest;

public class MD5Utils {
    /**
     * MD5加密 32位小写
     * @param paramString
     * @return
     */
    public static String md5Digest(String paramString){
        MessageDigest localMessageDigest;
        StringBuilder localStringBuilder = new StringBuilder();
        byte[] arrayOfByte =null;
        try {
            localMessageDigest = MessageDigest.getInstance("MD5");
            arrayOfByte = localMessageDigest.digest(paramString.getBytes("utf-8"));
            int j = arrayOfByte.length;
            for (int i = 0; i < j; i++)
            {
                String k = Integer.toHexString(arrayOfByte[i] & 0xFF);
                if (k.length() == 1) {
                    localStringBuilder.append("0");
                }
                localStringBuilder.append(k);
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return localStringBuilder.toString();
    }
}
